package pro.view.core;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

/**
 * @author  sangwo.y
 */
public class Card extends JLabel { //implements MouseListener, MouseMotionListener {
	
	private IHolder holder;
	//private GameView game;
	private int pX;
	//private GameView game;
	private int pY;
	public int offsetX;
	public int offsetY;

	public Card(IHolder holder) {
		setOpaque(true);
		setHolder(holder);
//		setVerticalAlignment(JLabel.TOP);
//        setHorizontalAlignment(JLabel.CENTER);
//        setBorder(BorderFactory.createLineBorder(Color.black));
        
	}
		
	public void setText(int s) {
		super.setText(Integer.toString(s));
	}
	
	
	/**
	 * @param holder  the holder to set
	 * @uml.property  name="holder"
	 */
	public void setHolder(IHolder holder) {
		this.holder=holder;
	}
	
	/**
	 * @return  the holder
	 * @uml.property  name="holder"
	 */
	public IHolder getHolder() {
		return holder;
	}
	
	public void setOffset(Point p) {
		offsetX=p.x-getLocation().x;
		offsetY=p.y-getLocation().y;
	}
	
	public boolean isMouseOver(Point p) {
		pX=p.x-getLocation().x;
		pY=p.y-getLocation().y;
		return contains(pX, pY);
	}
	
    public java.util.List<Card> cardsToDrag() {
    	return holder.cardsToDrag(this);
    }

   
}